'use strict';

const RouterService = require('./base');

class OfficeBuildingService extends RouterService {
    constructor(ctx) {
        super(ctx, 'OfficeBuilding');
    }
    getPage(where, page, pageSize) {
        console.log(where)
        return this.ctx.model[this.modelName].findAndCountAll({
            where,
            offset: pageSize * (page - 1),
            limit: pageSize,
            order: this.pageOrder() || [],
            include: [
                {
                    model: this.ctx.model.HouseFollowup,
                    as: 'followupList',
                    attributes: ['create_time', 'employee_name']
                }
            ]
        });
    }
    pageOrder() {
        return [['create_time', 'DESC']];
    }
    getSimpleFields() {
        return ['id', 'building_name']
    }
}

module.exports = OfficeBuildingService;
